package com.hwua.tqm;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.UIManager;

import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.border.StandardBorderPainter;
import org.jvnet.substance.button.ClassicButtonShaper;
import org.jvnet.substance.painter.StandardGradientPainter;
import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel;
import org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel;
import org.jvnet.substance.theme.SubstanceBottleGreenTheme;
import org.jvnet.substance.theme.SubstanceEbonyTheme;
import org.jvnet.substance.theme.SubstanceTerracottaTheme;
import org.jvnet.substance.title.FlatTitlePainter;
import org.jvnet.substance.watermark.SubstanceBinaryWatermark;

import com.jtattoo.plaf.aluminium.AluminiumLookAndFeel;
import com.jtattoo.plaf.bernstein.BernsteinLookAndFeel;
import com.jtattoo.plaf.fast.FastLookAndFeel;
import com.jtattoo.plaf.mcwin.McWinLookAndFeel;

/**
 * 设置主题
 * 
 * @author tianming
 *
 */
public class Theme {

	/**
	 * 设置substance主题
	 */
	public static void useTheme() {
		try {
			UIManager.setLookAndFeel(new SubstanceLookAndFeel());
			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
			SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
		} catch (Exception e) {
			e.getStackTrace();
		}
	}

	public static void useTheme(int index) {

		try {
			switch (index) {
			case 0:
				UIManager.setLookAndFeel(new SubstanceLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			case 1:
				UIManager.setLookAndFeel(new BernsteinLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			case 2:
				UIManager.setLookAndFeel(new AluminiumLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			case 3:
				UIManager.setLookAndFeel(new McWinLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			case 4:
				UIManager.setLookAndFeel(new FastLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			case 5:
				// 设置外观
				UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				// 设置主题
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceEbonyTheme());
				// 设置按钮外观
				SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper());
				// 设置水印
				SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBinaryWatermark());
				// 设置边框
				SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter());
				// 设置渐变渲染
				SubstanceLookAndFeel.setCurrentGradientPainter(new StandardGradientPainter());
				// 设置标题
				SubstanceLookAndFeel.setCurrentTitlePainter(new FlatTitlePainter());

				break;
			case 6:
				UIManager.setLookAndFeel(new SubstanceChallengerDeepLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceBottleGreenTheme());
				break;

			default:
				UIManager.setLookAndFeel(new SubstanceLookAndFeel());
				JFrame.setDefaultLookAndFeelDecorated(true);
				JDialog.setDefaultLookAndFeelDecorated(true);
				SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
				break;
			}

		} catch (Exception e) {
			e.getStackTrace();
		}
	}

}
